package cn.jiyun.mapper;

import cn.jiyun.pojo.Users;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @author Fay
 * @date 2022/6/21&13:03
 */
public interface UserMapper {
    /**
     * 添加
     * @param users
     */
    @Insert("insert into users(nam,pwd,sex,birth) values(#{nam},#{pwd},#{sex},#{birth})")
    public void insertUser(Users users);

    /**
     * 查询所有
     * @return
     */

    @Select("select * from users")
    public List<Users> listUser();

    @Select("select * from users where nam=#{nam} and pwd=#{pwd}")
    public Users login(Users users);

    @Delete("delete from users where id=#{id}")
    void findDelete(Integer id);
    @Select("select * from users where id=#{id}")
    Users toUpdate(Integer id);

    @Update("update users set nam=#{nam},pwd=#{pwd},sex=#{sex},birth=#{birth} where id=#{id}")
    void updateUsers(Users users);
}
